package com.sne.airways.route.pojo;

import com.sne.airways.basecore.pojo.BaseProperties;
import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;

/**
 * Created with IntelliJ IDEA.
 * User: 卞京帅{bjslogin@gmail.com}
 * Date: 12-11-20
 * Time: 下午10:33
 * 港口
 */
@Entity
@Table(name = "EXP_AIRPORT")
@BatchSize(size=5)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class ExpAirPort extends BaseProperties {

    @Id
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    @Column(length = 45)
    private String portId;//港口id

    @Column(length = 200)
    private String portName;//港口名称

    @Column(length = 40)
    private String portCode;//港口代码

    @Column(length = 400)
    private String portDesc;//描述

    @ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE},fetch = FetchType.LAZY)
    @JoinColumn(name = "countryId")
    private ExpCountry country;//所属国家

    @Transient
    private String portDetail;

    public String getPortId() {
        return portId;
    }

    public void setPortId(String portId) {
        this.portId = portId;
    }

    public String getPortName() {
        return portName;
    }

    public void setPortName(String portName) {
        this.portName = portName;
    }

    public String getPortCode() {
        return portCode;
    }

    public void setPortCode(String portCode) {
        this.portCode = portCode;
    }

    public String getPortDesc() {
        return portDesc;
    }

    public void setPortDesc(String portDesc) {
        this.portDesc = portDesc;
    }

    public ExpCountry getCountry() {
        return country;
    }

    public void setCountry(ExpCountry country) {
        this.country = country;
    }

    public String getPortDetail() {
        return this.portCode + "-" + this.portName;
    }

    public void setPortDetail(String portDetail) {
        this.portDetail = portDetail;
    }
}
